//
//  FtMessageViewController.m
//  Feast
//
//  Created by 胡光健 on 2017/8/25.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "FtMessageViewController.h"
#import "FtMessageCell.h"

@interface FtMessageViewController ()

@end

@implementation FtMessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"消息";
    
}
-(void)configTableView {
    self.needRefresh = YES;
    self.tableViewStyle = UITableViewStylePlain;
    [super configTableView];
    [self.tableView registerCellByNibName:@"FtMessageCell"];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 5;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    FtMessageCell * cell = [tableView dequeueReusableCellWithIdentifier:@"FtMessageCell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return [self headerInSection];
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 45;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 100;
}
-(UIView *)headerInSection {
    UIView * view = [UIView new];
    view.frame = CGRectMake(0, 0, mScreenWidth, 45);
    view.backgroundColor = HJColorRGB(243);
    UILabel * sectionLabel = [[UILabel alloc]init];
    sectionLabel.bounds = CGRectMake(0, 0, view.width * 0.5, view.height * 0.5);
    sectionLabel.center = CGPointMake(view.width *0.5, view.height * 0.5);
    sectionLabel.text = @"2017-08-09  16:42";
    sectionLabel.textAlignment = NSTextAlignmentCenter;
    sectionLabel.textColor = HJColorRGB(155);
    sectionLabel.font = [UIFont systemFontOfSize:mScreenWidth / 414 * 14];
    [view addSubview:sectionLabel];
    return view;
}
@end
